//
// Created by liushuai on 2020/3/24.
//
#include "isSymetric.h"
bool isSymmetric(TreeNode* leftChild,TreeNode* rightChild){
    if(!leftChild&&!rightChild)//左右都为空
        return true;
    if(!leftChild||!rightChild)//有一个为空
        return false;
    if(leftChild->val!=rightChild->val)//左右都为不空值不同
        return false;
    return isSymmetric(leftChild->left,rightChild->right)&&isSymmetric(leftChild->right,rightChild->left);

}
bool isSymmetric(TreeNode* root){
    if(!root)
        return true;
    else
        return isSymmetric(root,root);
}
